﻿using ApisixSDK.Admin.model.plugin;
using ApisixSDK.Common;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ApisixSDK.Admin.model
{
    public class Route : BaseModel
    {
       
        [JsonProperty(propertyName: "uri")]
        public string Uri { get; set; }
       
        [JsonProperty(propertyName: "uris")]
        public IList<string> Uris { get; set; }
       
        [JsonProperty(propertyName: "plugins")]
        public IDictionary<string, Plugin> Plugins { get; set; }
       
        [JsonProperty(propertyName: "upstream")]
        public Upstream Upstream { get; set; }
       
        [JsonProperty(propertyName: "upstream_id")]
        public string UpstreamId { get; set; }
       
        [JsonProperty(propertyName: "service_id")]
        public string ServiceId { get; set; }
        
        /// <summary>
        /// [可选]绑定的 Plugin config 配置 注：无法跟Script一起配置
        /// </summary>
        [JsonProperty(propertyName: "plugin_config_id")]
        public Plugin PluginConfigId { get; set; }
        /// <summary>
        /// [可选]标识路由名称
        /// </summary>
        [JsonProperty(propertyName: "name")]
        public string Name { get; set; }
        [JsonProperty(propertyName: "desc")]
        public string Desc { get; set; }
       
        [JsonProperty(propertyName: "host")]
        public string Host { get; set; }
        
        [JsonProperty(propertyName: "hosts")]
        public IList<string> Hosts { get; set; }
       
        [JsonProperty(propertyName: "remote_addr")]
        public string Remote_addr { get; set; }
       
        [JsonProperty(propertyName: "remote_addrs")]
        public IList<string> Remote_addrs { get; set; }

        /// <summary>
        /// [可选]如果为空或没有该选项，代表没有任何 method 限制，也可以是一个或多个的组合：GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS，CONNECT，TRACE。
        /// <code>例如：{"GET", "POST"}</code>
        /// </summary>
        [JsonProperty(propertyName: "methods")]
        public IList<string> Methods { get; set; }
        /// <summary>
        /// [可选]如果不同路由包含相同 uri，根据属性 priority 确定哪个 route 被优先匹配，值越大优先级越高，默认值为 0。
        /// </summary>
        [JsonProperty(propertyName: "priority")]
        public int? Priority { get; set; }
        /// <summary>
        /// [可选]用户自定义的过滤函数。可以使用它来实现特殊场景的匹配要求实现。该函数默认接受一个名为 vars 的输入参数，可以用它来获取 Nginx 变量。
        /// </summary>
        [JsonProperty(propertyName: "filter_func")]
        public string Filter_func { get; set; }

        /// <summary>
        /// [可选]是否启用此路由, 缺省 1。
        /// <code>1 表示启用，0 表示禁用</code>
        /// </summary>
        [JsonProperty(propertyName: "status")]
        public int? Status { get; set; }
        /// <summary>
        /// [可选]为 route 设置 upstream 的连接、发送消息、接收消息的超时时间。这个配置将会覆盖在 upstream 中 配置的 timeout 选项
        /// </summary>
        [JsonProperty(propertyName: "timeout")]
        public Timeout Timeout { get; set; }
        /// <summary>
        /// [可选]标识附加属性的键值对	
        /// <code>例：{"version":"v2","build":"16","env":"production"}</code>
        /// </summary>
        [JsonProperty(propertyName: "labels")]
        public string Labels { get; set; }
       
    }
}
